package com.hqd.ch03.v22.aop;

import com.hqd.ch03.v22.aopalliance.aop.Advice;

public interface Advised extends TargetClassAware {
    /**
     * 获取代理接口
     */
    Class<?>[] getProxiedInterfaces();

    boolean isInterfaceProxied(Class<?> intf);

    TargetSource getTargetSource();

    void setTargetSource(TargetSource targetSource);

    /**
     * 配置是否冻结，此时配置不允许修改
     */
    boolean isFrozen();

    /**
     * 是否使用类代理
     */
    boolean isProxyTargetClass();

    boolean isExposeProxy();

    void setExposeProxy(boolean exposeProxy);

    Advisor[] getAdvisors();


    default int getAdvisorCount() {
        return getAdvisors().length;
    }


    void addAdvisor(Advisor advisor);


    void addAdvisor(int pos, Advisor advisor);


    boolean removeAdvisor(Advisor advisor);


    void removeAdvisor(int index);


    int indexOf(Advisor advisor);


    boolean replaceAdvisor(Advisor a, Advisor b);


    void addAdvice(Advice advice);

    void addAdvice(int pos, Advice advice);


    boolean removeAdvice(Advice advice);


    int indexOf(Advice advice);

}
